#[cfg(test)]
mod test{
    use std::mem::size_of;

    /// 当前函数会验证 Option在不同作用域是否会变更地址 
    fn o1(m1: Option<&i32>) -> Option<i32> {
        println!("01 当前指针n：{:p}", &m1);
        let n = 5;
        let s = Some(&n);
        println!("当前指针s：{:p}", &s);
        let s1 = Some(&n);
        println!("当前指针s1：{:p}", &s1);
        
        println!("当前指针：{:p}", &n);
        let o: Option<i32> = Some(5);
        println!("当前指针：{:p}", &o);
        o
    }  

    fn o2() {
        let n = Some(&5);
        println!("02 当前指针n：{:p}", &n);
        let o = o1(n);
        println!("当前指针：{:p}", &o);
    }      

    // 验证不同类型的大小
    #[test]
    fn test() {
        println!("{:?}", size_of::<Option<i32>>());
        println!("{:?}", size_of::<i32>());
    }

    #[test]
    fn test1() {
        println!("{:?}", size_of::<Option<&i32>>());
        println!("{:?}", size_of::<&i32>());
    }
    #[test]
    fn test2() {
        let f = 5;
        println!("{:?}", size_of_val(&f));
        println!("{:?}", size_of_val(&Some(&f)));
        let x:i32 = *&5; 
    }

    #[test]
    fn test3() {
       let o: Option<i32>     = Some( 5);
        let t: Option<i32>  = None;
        println!("{:?}", size_of_val(&o));
        println!("{:?}", size_of_val(&t));

        let o1: Option<&i32>     = Some(&5);
        let t1: Option<&i32>  = None;
        println!("{:?}", size_of_val(&o1));
        println!("{:?}", size_of_val(&t1));
    }

    #[test]
    fn test4() {
        o2();
    }

}